import React, { Component } from 'react';
import Alert from '@material-ui/lab/Alert';
import "./YTKAlert.less"
import { connect } from 'react-redux';
/*
error: 红
warning: 橙
info: 蓝
success: 绿
*/


 class YTKAlert extends Component {
 
    render() {
        return (
            <div>
                <Alert style={{ display: this.props.showAlert ? "flex" : "none" }} variant="filled" severity={this.props.alertType}>
                    {this.props.alertContent}
                </Alert>
                {/* <Alert variant="filled" severity="warning">
        This is a warning alert — check it out!
      </Alert>
      <Alert variant="filled" severity="info">
        This is an info alert — check it out!
      </Alert>
      <Alert variant="filled" severity="success">
        This is a success alert — check it out!
      </Alert> */}
            </div>
        )
    }
}
const mapStateToProps=state=>{
    return{
        showAlert:state.showAlert,
        alertType:state.alertType,
        alertContent:state.alertContent

    }
}
export default connect(mapStateToProps)(YTKAlert)